using System;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace WcfExtensions.ServiceModel.TestClient.Scenarios.Basic
{
    [DataContract(Namespace = "http://localhost/wcftest/newsmessage")]
    internal class NewsMessage
    {
        [DataMember(IsRequired = true)]
        public string Message;

        [DataMember(IsRequired = true)]
        public DateTime TimeStamp;
    }

    [ServiceContract]
    internal interface IBasicService
    {
        [OperationContract(IsOneWay = true)]
        void Ping(DateTime timestamp);

        [OperationContract]
        void Ping2(Message message);

        [OperationContract]
        string WelcomeGenerator(string name);

        [OperationContract]
        string SendMessage(NewsMessage message);
    }

    internal class BasicService : IBasicService
    {
        #region IBasicService Members

        public string WelcomeGenerator(string name)
        {
            return String.Format("Hello {0}!", name);
        }

        public string SendMessage(NewsMessage message)
        {
            return "Message Received";
        }

        public void Ping(DateTime timestamp)
        {
            Console.WriteLine("Pinged {0}", timestamp);
        }

        public void Ping2(Message message)
        {
            Console.WriteLine("Ping received");
        }

        #endregion
    }
}